<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/taglib.jsp" %>
<html>
<head>
<script type="text/javascript">
    // 项目部署根路径
    var BASE_URL = '${ctx}';
    // 图片上传路径
    var SERVER_URL = '${ctx}/file/FEEDBACK_IMG/uploadFile';
    // 过滤文件类型
    var ACCEPT = {
        title: 'Images',
        extensions: 'gif,jpg,jpeg,bmp,png',
        mimeTypes: 'image/*'
    };
    // 新增的图片集合
    var ADD_IMGS = [];
</script>

<link rel="stylesheet" href="${ctx}/static/css/Master.css">
<link rel="stylesheet" href="${ctx}/static/css/lq.datetimepick.css">
<link href="${ctx}/static/css/default.css" type="text/css" rel="stylesheet"/>
<link href="${ctx}/static/css/uploadify.css" type="text/css" rel="stylesheet"/>
<script src="${ctx}/static/js/jquery-1.8.0.min.js"></script>
<script src="${ctx}/static/js/simpletooltip.min.js"></script>
<script src="${ctx}/static/js/selectUi.js"></script>
<script type="text/javascript" src="${ctx}/static/js/jquery.validate.min.js"></script>
<link href="${ctx}/static/css/validation.css" type="text/css" rel="stylesheet"/>
<link rel="stylesheet" href="${ctx}/static/css/jquery-labelauty.css"/>
<script src="${ctx}/static/js/jquery-labelauty.js"></script>
<script type="text/javascript" src="${ctx}/static/js/jquery.metadata.js"></script>
<script src="${ctx}/static/plugins/layer/layer.js"></script>
<%-- 基础js,所有页面都需要引入此js,依赖layer.js --%>
<script src="${ctx}/static/js/common/base.js"></script>

<link rel="stylesheet" type="text/css" href="${ctx }/static/plugins/webuploader/css/webuploader.css">
<link rel="stylesheet" type="text/css" href="${ctx }/static/plugins/webuploader/css/auto.css">

<script type="text/javascript" src="${ctx }/static/plugins/webuploader/js/webuploader.js"></script>
<script type="text/javascript" src="${ctx }/static/plugins/webuploader/js/auto.js"></script>
</head>


<script>
   $(function(){
   var form;
   $("#form1").validate({
		   
       rules:{
			  feeTitle:{
                   required:true,
                   maxlength:20
                   
               },
               feeInfo:{
                   required:true,
                   maxlength:500
               },
               feeTheme:{
            	   feeTheme:true
               }    
           },messages:{
        	   feeTitle:{
                   required:"必填",
                   maxlength:"字数限制，最多输入20个文字"
               },
               feeInfo:{
                   required:"必填",
                   maxlength:"字数限制，最多输入500个文字"
                  
               },
               feeTheme:{
                   required:"请选择反馈类型"
                  
               }
              
           }
    
	   });
   
   
   jQuery.validator.addMethod("feeTheme",function(value,element){
		if(value==-1)
		{return false;}
		 return true;
		},"请选择反馈类型");
 
  
   });
   
   
 
   var filelist=[];//新增的图片集合

	   	    
    function formSubmit(){
	   // 文件json字符串
       var fileJsonStr = JSON.stringify(ADD_IMGS);
       
	   var form=$("#form1");
	   // 表单json对象
	   var formJson = form.serializeJson();
	   
	   // 将文件json字符串添加到表单json对象
	   formJson.fileJson = fileJsonStr;
	   
	   if(!form.valid()){
		   return false;
	   }
	   
	   $.ajax({    
		    url:"${ctx}/feedback/saveFeedback",
		    data: formJson,    
		    type:"post",    
		    cache:false,    
		    dataType:"json",
		    async:true, //默认为true 异步    
		    success:function(data) {
		        top.layer.msg(data,{},function(){
		        	window.location="${ctx}/feedback/myList";   
	            });
		     }
		});
 
   }
    
</script>

<body>

			<section class="boxRight">
				<div class="OrgTit">编辑建议与反馈</div>
				<form action="" id="form1">
				<div class="context">
					<div class="add_firstmenu">
						<dl>
							<dt>
								<span class="im">*</span>反馈类型
							</dt>
							<dd>
								<div id="select1" >
								<select name="feeTheme" id="feeTheme">
								<option value="-1">请选择反馈类型</option>
							  <c:forEach items="${diy:getDicList('FEE_THEME')}" var="dic">
						       <option value="${dic.code}" checked>${dic.content}</option>
						       </c:forEach>
								</select>
								</div>
							</dd>
						</dl>
						<dl>
							<dt>
								<span class="im">*</span>标题
							</dt>
							<dd>
								<input name="feeTitle" type="text" class="w3"  style="width:400;height:35"/>
								<!--  
								<div class="textarea_tip">字数限制，最多输入20个文字</div>-->
							</dd>
						</dl>
						<dl>
							<dt>
								<span class="im">*</span>内容
							</dt>
							<dd>
								<div class="textareaBox w2">
									<textarea  name="feeInfo" style="height: 80px;""></textarea>
								</div>
								<!--  
								<div class="textarea_tip">字数限制，最多输入500个文字</div>
								-->
							</dd>
							<input type="hidden" name="feeType" value=2>
							
						</dl>
						
						<dl>
							<dt>图片</dt>
							<dd>
							
								<div id="uploader" class="wu-example"  style="width: 542px;">
									<%-- 文件队列区域 --%>
								    <div class="queueList">
								    	<%-- 拖拽区域 --%>
								        <div id="dndArea" class="placeholder">
								            <div id="filePicker" class="webuploader-container">
								            	<div class="webuploader-pick">点击选择图片</div>
								            </div>
								            <p>您还可以将照片拖到这里或使用截屏工具后激活本窗口并粘贴</p>
								        </div>
								        <%-- 文件列表 --%>
								    	<ul class="filelist"></ul>
								    </div>
								    <%-- 状态按钮区域 --%>
								    <div class="statusBar" style="display:none;">
								        <div class="progress" style="display: none;">
								            <span class="text">0%</span>
								            <span class="percentage" style="width: 0%;"></span>
								        </div><%--<div class="info">共0张（0B），已上传0张</div>--%>
								        <div class="btns">
								            <div id="filePicker2" class="webuploader-container">
								            	<div class="webuploader-pick">继续添加</div>
								           	</div>
								           	<!-- <div class="uploadBtn state-pedding">开始上传</div> -->
								        </div>
								    </div>
								</div>

							</dd>
						</dl>
						
						<div class="combtn"><a href="javascript:void(0);" onclick="formSubmit()">提交</a><a href="javascript:void(0);" onclick="history.back();">返回</a></div>
						<!--  
						<div class="combtn"><input type="submit" name="sub" value="提交"><input type="button" name="butt" value="清空"></div>
						 -->
					</div>
				</div>
			</form>
		</section>
</body>
</html>